package com.study.hot.jetpack.livedata

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel

/**
 * <pre>
 *     author : fauks
 *     time   : 2020/03/24
 *     desc   :
 * </pre>
 */
class CustomLiveData : ViewModel() {
    val liveDataNum: MutableLiveData<Int> by lazy {
        MutableLiveData<Int>(0)
    }

    fun addNum() {
        if (liveDataNum.value != null) {
            liveDataNum.value = liveDataNum.value!! + 1
        }
    }
}